using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class Sun : MonoBehaviour
{
    public float sunTime = 1;
    public int addsun = 25;
    public void MoveTo(Vector3 sunPos)
    {
        transform.DOMove(sunPos, sunTime);
    }
    public void JumpTo(Vector3 sunPos)
    {
        sunPos.z = -1;
        Vector3 centerPos = (transform.position + sunPos) / 2;
        float dis = Vector3.Distance(transform.position, sunPos);
        centerPos.y += (dis / 2);
        transform.DOPath(new Vector3[] { transform.position,centerPos,sunPos},sunTime,PathType.CatmullRom).SetEase(Ease.OutQuad);
    }
    public void OnMouseDown()
    {
        transform.DOMove(SunNumber.Instance.GetSunPos(), sunTime)
            .SetEase(Ease.OutQuad)
            .OnComplete(
            () =>
            {
                Destroy(this.gameObject); 
                SunNumber.Instance.AddSun(addsun);
            }
            );
    }
}
